/*
	Flie:						MessageSystem.h
	Course:				SGP 1208
	Author:				Kori Po
	Purpose:			Message system
*/
#pragma once

#include "IMessage.h"
#include <queue>

typedef void (*MESSAGEPROC)(IMessage*);

class CMessageSystem
{
private:
	std::queue<IMessage*>		m_MsgQueue;
	MESSAGEPROC						m_MsgProc;

	CMessageSystem()	{m_MsgProc = NULL; }
	CMessageSystem(const CMessageSystem& );
	CMessageSystem& operator=(const CMessageSystem&);

	~CMessageSystem() {};

public:
	static CMessageSystem* GetInstance(void);

	//Messages in Queue
	inline int GetNumMessage(void) {return (int)m_MsgQueue.size();}

	//setup the function pointer
	void InitMessageSystem(MESSAGEPROC m_TheProc);

	// Send the Message into the queue
	void SendMsg(IMessage* pMsg);

	// Process all Messages
	void ProcessMessages(void);

	// Clear any Messages
	void ClearMessages(void);

	// Close all doors
	void ShutdownMessageSystem(void);
};
